home *** CD-ROM | disk | FTP | other *** search
- Subject: travel-itinerary macros for nroff
- From: Jerry Peek (Tek CSC Training) <tektronix!tektools!jerryp>
- Newsgroups: mod.sources
- Approved: jpn@panda.UUCP
-
- Mod.sources: Volume 4, Issue 75
- Submitted by: Jerry Peek (Tek CSC Training) <tektronix!tektools!jerryp>
-
- Here's a package of nroff/troff macros that makes itineraries for trips by car.
- For an example of the way they work, see the man page below.
- There's also an announcement/example on net.travel and net.sources.
-
- A quick overview: You give them a starting day/date, tell them how
- much gas costs (dollars, francs, etc.) and your car's fuel economy
- (miles/gallon or kilometres/litre). Then, you make an entry for each day.
- The macros keep daily and running totals of miles driven and the cost.
- There are other macros included for food, lodging, and miscellaneous expenses.
-
- --Jerry Peek, Tektronix, Inc.
- US Mail: MS 74-222, P.O. Box 500, Beaverton, OR 97077
- uucp: {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp
- CS,ARPAnet: jerryp%tektools@tektronix.csnet
- Phone: +1 503 627-1603
-
- P.S. I'm no expert on n/troff macros [is anyone? :-)], but several people
- around here (including me) have used them, and they seem to work fine.
- Suggestions, bug fixes, etc. are welcome, though! Still, here's the usual
- disclaimer about no guarantee of performance, suitability, etc. etc.
-
-
- ======== CUT ======== HERE ======== AND ====== FEED ====== TO ===== sh ========
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # mti.7
- # tmac.ti
- # This archive created: Mon Apr 21 10:22:23 1986
- export PATH; PATH=/bin:$PATH
- echo shar: extracting "'mti.7'" '(13115 characters)'
- if test -f 'mti.7'
- then
- echo shar: will not over-write existing file "'mti.7'"
- else
- cat << \SHAR_EOF > 'mti.7'
- .de xX \" automatic revision-date macro
- .ds Da \\$4
- ..
- .xX $Header: mti.7,v 1.6 86/02/09 14:45:48 jerryp Exp $
- .\"
- .TH MTI 7 "\*(Da"
- .UC 4
- .SH NAME
- mti \- travel-itinerary formatting macros
- .SH SYNOPSIS
- \fBnroff \-mti\fP [ \-rQ2 ] [ options ] file ...
- .br
- \fBtroff \-mti\fP [ \-rQ2 ] [ options ] file ...
- .SH DESCRIPTION
- This package of \fInroff\fP\| and \fItroff\fP\|
- macro definitions makes formatted travel itineraries.
- They're especially designed for road trips \(em
- through they'll work for other kinds of travel, too.
- .PP
- You give them the starting date, the time and mileage points you'll
- hit each day, and each food/lodging expense you plan.
- (You also need to store the cost of travelling \(em usually fuel economy,
- with other fixed traveling expenses optional).
- They'll output an itinerary that lists each timepoint and expense,
- as well as daily and running totals of cost and distance.
- .SH EXAMPLE
- Here's a small part of a finished (fictional) itinerary, with `. . .' in place
- of the omitted lines:
- .nf
- '\" kludges to make .tl titles line up with current margins:
- .lt -0.5i
- .po +0.5i
- .ft B
- .
- .
- .tl'ITINERARY'Page 6'CROSS-COUNTRY MOVE'
- .
- .
- .in -0.5i
- 6 PM Camp near Dustbowl, NM
- LODGING: Camping fee $8.
-
- TODAY: 415 mi. in 9 hours for $18; other costs $8; total $26
- TO DATE: 1690 miles, $77
- \l'6i\(em'
- DAY #7 OF TRIP: Friday, 6/21
- .in
-
- .tl '7 AM NM-18, US-87 to Dalhart, TX''129 mi'
- .tl '9 AM Time-zone change from MDT to CDT'''
- .tl '10 AM TX-297, TX-281, US-22, US-83 to Canadian, TX''135 mi'
- .tl 'FOOD: Lunch in Canadian? $6.'''
- .tl '1 PM US-83, OK-54, I-40 to Oklahoma City''140 mi'
- .in -0.5i
- 4 PM Arrive at Fred Smith's home
-
- TODAY: 404 mi. in 8 hours for $17; other costs $6; total $23
- TO DATE: 2094 miles, $100
- \l'6i\(em'
- DAY #8 OF TRIP: Saturday, 6/22
- .
- .
- '\" if this line crosses a page boundary, page footer/header will be indented!
- .ft P
- .in
- .lt +0.5i
- .po -0.5i
- .fi
- .ad
- .PP
- The source (unformatted) itinerary commands are flexible enough that it's easy
- to rearrange your itinerary, try alternate routes, etc... after you've set up
- an itinerary, the macros will calculate the total trip length and expenses.
- .PP
- For example, here are the lines that produced the itinerary above.
- Start each day with \fI.SD\fR, use \fI.EN\fR for each entry, and
- use \fI.ED\fR at the end of each day.
- Lodging expenses are marked with \fI.LO\fR, and \fI.FO\fR is for food:
- .nf
- .na
- .ft B
- .sp
- .EN 6 PM "Camp near Dustbowl, NM"
- .LO "Camping fee" 8
- .ED 9
- .SD
- .EN 7 AM "NM-18, US-87 to Dalhart, TX" 129
- .EN 9 AM "Time-zone change from MDT to CDT" 0
- .EN 10 AM "TX-297, TX-281, US-22, US-83 to Canadian, TX" 135
- .FO "Lunch in Canadian?" 6
- .EN 1 PM "US-83, OK-54, I-40 to Oklahoma City" 140
- .EN 4 PM "Arrive at Fred Smith's home" 0
- .ED 8
- .SD
- .ft P
- .fi
- .ad
- .sp
- The argument to ED is the number of hours spent traveling that day.
- The last argument to EN is the number of miles driven since the previous
- timepoint.
- .PP
- All the \fI\-mti\fR macros are defined below.
- It's okay to use most \fInroff\fP\| and \fItroff\fP\| requests
- with this package.
- However, watch out for fill- and non-fill modes, because
- the macros switch back and forth between the two modes.
- See the individual macro descriptions below.
- Also, be careful about setting number and string registers:
- the macros use a few of them (see the list below).
- .PP
- Font and point size changes with \ef and \es are also allowed;
- for example, ``\efIword\efR'' will italicize \fIword.\fP
- .SH OPTION
- If you use \fI\-rQ2\fR on the commandline, the macros won't print the
- \fBTODAY:\fR and \fBTO DATE:\fR summaries at the end of each day.
- Other commandline options go directly to \fInroff\fR or \fItroff\fR.
- .SH REGISTERS AND MACROS
- Here's a summary of the number and string registers \(em and the macros \(em
- that make up the
- .I \-mti
- macros.
- After the summary are detailed explanations and examples of each.
- So, beginners can safely skip this reference section for now.
- This list doesn't include internal macros and registers.
- .ne 5
- .tr _.
- .ta \w'Regist.Nam'u +\w'InitialVal'u +\w'String/ 'u
- .sp
- .nf
- Regist. Initial String/ \0 Explanation
- Name Value Number
- .sp .3
- _CS $ str currency-unit symbol
- _DT \- num numerical date of trip start
- _DU \- num distance per currency unit
- _DY \- str name of day when trip starts
- _FD \- num number days in February
- _MN \_ num numerical month of trip start
- _TI \_ str title for top corner each page
- _UL miles str distance unit name, long
- _US mi str distance unit name, short
- .sp 2
- .ta \w'MacroNam'u +\w'NumberAr'u +\w'ReqdOptl 'u
- .sp .3
- Macro Number Req'd/ \0 Explanation
- Name Args. Opt'nl
- .sp .3
- _ED 1 reqd end of day
- _EN 4 reqd timepoint entry
- _ET 0 reqd end of title page
- _FO 2 optl food expense
- _LO 2 optl lodging expense
- _OE 2 optl other expenses
- _SD 0 reqd start of daily entry
- _ST 2 reqd start of title block
- .fi
- .ie n .ta 0.8i 1.6i 2.4i 3.2i 4.0i
- .el .ta 0.5i 1i 1.5i 2i 2.5i 3i 3.5i 4i
- .SH "SOURCE-FILE DESCRIPTION"
- This part of the manual describes what you should put in a
- source (unformatted) itinerary file.
- .sp 2
- The \fBFIRST SECTION\fR of each file stores numbers and strings (words) that
- set the initial conditions (starting date, fuel economy, etc.).
- You can put these first few lines in any order, as long as they're all at
- the top of the file.
- Individual descriptions:
- .TP 12
- .B \&.ds DY Day
- .I Required:
- day of the week that trip starts.
- First letter of day must be capitalized, rest lower-case.
- No abbreviations.
- Example:
- .br
- \fB.ds DY Saturday\fR
- .TP 12
- .B \&.nr DT Date
- .I Required:
- numerical date when the trip starts.
- For example, if the trip started on August 15th:
- .br
- \fB.nr DT 15\fR
- .TP 12
- .B \&.nr MN Month\fR
- .I Required:
- numerical month that the trip starts (January = 1, February = 2, etc.).
- Example:
- .br
- \fB.nr MN 8\fR
- .TP 12
- .B \&.nr DU xx
- .I Required:
- Distance you can travel for each currency-unit you spend (in the U.S.,
- number of miles that cost one dollar; in France, kilometres you can travel for
- one Franc; etc.).
- This rather weird number was designed to get around a problem:
- .I nroff
- and
- .I troff
- can't do decimal arithmetic -- only integers.
- Here are two examples that should clear things up:
- .sp
- On your trip across the U.S., you guess that you'll get 30 miles/gallon,
- and that gas will cost $1.25 per gallon.
- So, the miles per dollar are:
- .ft B
- .nf
- .na
- .sp
- 30 miles/gallon
- -----------------------\0=\024\0miles/dollar
- 1.25 dollars/gallon
- .ad
- .fi
- .ft P
- .sp
- \&...which means that you'd put this line in your source file:
- .br
- \fB.nr DU 24\fR
- .sp
- Or, if you were driving across Europe, getting 17 kilometres/litre and
- spending DKK 6- per litre, the setting of \fBDU\fP should be 17 divided by 6,
- or about 3 kilometres per DKK.
- So, you'd put this line in your itinerary:
- .br
- \fB.nr DU 3\fR
- .TP 12
- .B \&.nr FD 2x
- .I Required:
- Number of days in February \(em 28 or 29.
- Tells program whether this is a leap year.
- Must be set, even if your itinerary doesn't include February.
- For example, if there are 28 days in February during the year of your trip (a
- non-leap year):
- .br
- \fB.nr FD 28\fR
- .sp
- If your trip crosses two years but only one February, set FD for the
- number of days in the February when you'll be traveling.
- .TP 12
- .B \&.ds TI TITLE
- .I Optional:
- title for upper right-hand corner of each page.
- If you don't define it, it'll be blank.
- Here's how you could define it:
- .br
- \fB.ds TI CROSS-COUNTRY TRIP\fR
- .TP 12
- .B \&.ds CS xxx
- .I Optional:
- currency symbol (default = \fB$\fR).
- Can be set to other currency names, like \fISKR\fR, this way:
- .br
- \fB.ds CR SKR\fR
- .sp
- This is used in the \fBTODAY:\fR and \fBTO DATE:\fR lines printed at the end
- of each day.
- .sp
- Normally, the currency symbol and the cost are printed touching each other,
- like \fB$123\fR or \fBhfl162\fR (Dutch Guilder).
- If you want space after the currency symbol (like \fBhfl\ 162\fR),
- use a backslash and a trailing blank when you define the currency symbol.
- For example,
- .br
- \fB.ds CR hfl\e\ \fR
- .br
- Just be sure to put the blank after the backslash!
- .TP 12
- .B \&.ds US units
- .I Optional:
- the units of distance, short name.
- The default is \fImi\fR (miles)..
- To change it to, say, \fIkm\fR:
- .br
- \fB.ds US km\fR
- .TP 12
- .B \&.ds UL units
- .I Optional:
- the units of distance, long name, plural.
- The default is \fImiles\fR.
- To change it to, say, \fIkilometers\fR:
- .br
- \fB.ds UL kilometers\fR
- .PP
- .sp 2
- The \fBTITLE SECTION\fR is usually short.
- It starts with the \fI.ST\fR macro, and ends with \fI.ET\fR.
- If you want other text on the title page, you can put it between the macro
- calls.
- .TP 12
- \fB\&.ST\0"First line"\0"Second line"\fR
- .I Required:
- after you've set the number and string registers in the first section,
- you must use \fI.ST\fR (start title page).
- If you want a title on the first page, it can have one or two lines...
- the macros will make it in larger type and center each line.
- .sp
- Quote each line of the title, and put the text on the same line as
- the \fI.ST\fR call.
- If you don't want one or both lines, just leave them out.
- Example:
- .br
- \fB.sT\0"Our trip"\0"to Lower Slobovia"\fR
- .sp
- After the \fI.ST\fP, you can put text for the title page.
- You'll usually want to skip down a few lines (say, \fB.sp 5\fR)
- before starting the text.
- The title page is made in no-fill mode, so what you type in will be exactly
- what appears on the title page.
- You can start fill mode (\fB.fi\fR and maybe \fB.ad\fR), but BE SURE to
- go back to non-fill mode (\fB.nf\fR) before you use the \fB.ET\fR macro!
- .TP 12
- .B \&.ET
- .I Required:
- At the end of the title page (after the \fB.ST\fP and the optional text),
- end the title page with \fB.ET\fR.
- .PP
- .sp 2
- The last part of the file are the \fBDAILY ENTRIES\fR, which are enclosed
- with \fB.SD\fR and \fB.ED\fR macro calls. Here are the details:
- .TP 12
- .B \&.SD
- Each day's entry must start with the \fI.SD\fR macro.
- Put it on a line by itself.
- .TP 12
- \fB\&.EN time AM/PM "description" distance
- .I Required:
- For each timepoint in a day, use the \fI.EN\fR (entry) macro.
- The first argument is the clock time, a number between 1 and 12 (though
- 24-hour time will work fine here).
- .sp
- If you use a 12-hour clock, the second argument should be AM, PM, NOON, or
- something like that.
- On a 24-hour clock, use your imagination.
- .sp
- You should put quotes around the third argument, which is usually the
- description of a route you're taking since the last timepoint.
- It can also hold the name of a destination.
- .sp
- The fourth argument must be a number \(em the distance travelled
- during this entry.
- (Or, in other words, the distance travelled since the previous entry.)
- .sp
- Here's an example.
- It's 10 AM and you're about to leave Auckland, New Zealand for a trip to
- Rotorua.
- The trip is via highways 3 and 12 and is 200 kilometres long (I'm making this
- up!).
- You'd write this \fI.EN\fP macro:
- .br
- \fB.EN\010\0AM\0"Hwys. 3, 12 to Rotorua"\0200
- .TP 12
- \fB\&.FO "description" cost\fR
- .I Optional:
- When you plan to spend money for food, note it with \fI.FO\fR.
- You must use \fI.FO\fR between a pair of \fI.SD\fR and \fI.ED\fR macros.
- .sp
- Example: in the middle of the day, you plan to spend $55 for lunch for your tour
- group.
- You might use this entry:
- .br
- \fB.FO "lunch at El Greaso, Dallas" 55\fR
- .TP 12
- \fB\&.LO "description" cost\fR
- .I Optional:
- When you plan lodging expenses, note them with \fI.LO\fR.
- Use \fI.LO\fR between a pair of \fI.SD\fR and \fI.ED\fR macros.
- .sp
- Example: You'll be staying at the Waldorf-Astoria tonight, spending $1000.
- You might use this entry, including the phone number for convenience:
- .br
- \fB.LO "Waldorf-Astoria, 212/345-2999" 1000\fR
- .TP 12
- \fB\&.OE "description" cost\fR
- .I Optional:
- The \fI.OE\fR (capital letter O) macro is for expenses besides food and
- lodging.
- You have to use \fI.OE\fR between a pair of \fI.SD\fR and \fI.ED\fR macros.
- .sp
- Example: You expect a transmission overhaul in Nairobi:
- .br
- \fB.OE "Rebuild transmission" 550\fR
- .TP 12
- .B \&.ED total-time
- .I Required:
- At the end of each day's entries, use \fI.ED\fR with the total time spent
- traveling that day.
- This is usually the elapsed time between the first and last timepoints in the
- day \(em unless you're crossing time zones.
- .sp
- Example: If you started traveling at 9 AM and finished at 5 PM, that's 8
- hours of traveling:
- .br
- \fB.ED 8\fR
- .TP 12
- .B lines with no macros
- If you don't use a macro on a line, the line will be copied directly
- to the itinerary without filling, adjusting, or wrapping.
- The lines may look better if you indent them with a tab character.
- .SH FILES
- /usr/lib/public/tmac/tmac.ti
- .SH SEE ALSO
- .IR ms (7),
- .IR nroff (1),
- .IR troff (1).
- .SH BUGS
- More default settings might be nice.
- Some parts could be shortened by using subroutines.
- Internal register names aren't unique enough and may conflict with any
- registers that the user defines.
- .SH AUTHOR
- Jerry Peek; Portland, Oregon.
- .PP
- I'm not an expert at formatter macros, so use these at your own risk.
- I'll take no responsibility for their accuracy or suitability for any purpose.
- .PP
- Bugs and rewrites to jerryp%tektools@tektronix.csnet or
- {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp.
- Flames will probably be ".ig"'ed.
- SHAR_EOF
- if test 13115 -ne "`wc -c < 'mti.7'`"
- then
- echo shar: error transmitting "'mti.7'" '(should have been 13115 characters)'
- fi
- fi
- echo shar: extracting "'tmac.ti'" '(6340 characters)'
- if test -f 'tmac.ti'
- then
- echo shar: will not over-write existing file "'tmac.ti'"
- else
- cat << \SHAR_EOF > 'tmac.ti'
- '\" $Header: tmac.ti,v 1.26 86/02/15 11:20:14 jerryp Exp $
- '\" $Source: /usr1/sys/usr/lib/public/tmac/tmac.ti,v $
- '\"
- '\" ti travel-itinerary macros for nroff/troff
- '\" Jerry Peek; Portland, OR; tektronix!tektools!jerryp
- '\"
- .nf
- .na
- '\" Set line length to 8 inches (nroff only) so ".EN" entries can be longer:
- .nr St 0 \" dumb register that counts use of ST and ET macros
- .if n \{\
- .ll 8i
- .lt 8i \}
- .nr MI 0 \" total miles/kilometers
- .nr MT 0 \" miles or km today
- .nr CO 0 \" total cost
- .nr CT 0 \" cost today
- .nr DA 0 1 \" total number of days and amount (1 day) to increment by
- '\" Units to use: miles or km. UL is long, for daily summaries; US is short,
- '\" used on each line. User can re-define in file; should be lower-case:
- .ds UL miles
- .ds US mi
- '\" Currency symbol. User can re-define in file.
- '\" Can have several characters, including trailing blanks:
- .ds CS $
- '\" Start-itinerary macro. $1 = title for first page.
- '\" $2 = optional second title line.
- .de ST
- '\" Check flag to see if user has already invoked ST macro. If so, scream.
- '\" If not, set flag:
- .if !\\n(sT=0 .ER "only one .ST per file, please."
- .nr sT 1
- .if !\\n(eT=0 .ER "You must use the .ET macro after the .ST"
- '\" Because first .SD will increment starting day, decrement it here.
- '\" Also, be sure starting day name is valid (if valid, set cK to 0):
- .nr cK 1
- .if '\\*(DY'Sunday' \{\
- .ds Dy Saturday
- .nr cK 0\}
- .if '\\*(DY'Monday' \{\
- .ds Dy Sunday
- .nr cK 0\}
- .if '\\*(DY'Tuesday' \{\
- .ds Dy Monday
- .nr cK 0\}
- .if '\\*(DY'Wednesday' \{\
- .ds Dy Tuesday
- .nr cK 0\}
- .if '\\*(DY'Thursday' \{\
- .ds Dy Wednesday
- .nr cK 0\}
- .if '\\*(DY'Friday' \{\
- .ds Dy Thursday
- .nr cK 0\}
- .if '\\*(DY'Saturday' \{\
- .ds Dy Friday
- .nr cK 0\}
- .if \\n(cK .ER ".ST: day name DY is missing or invalid."
- .rr cK
- .rm DY
- .if \\n(DU<1 .ER ".ST: DU undefined or less than 1. Can't calculate fuel cost."
- .if (\\n(FD<28):(\\n(FD>29) .ER ".ST: FD undefined, or not 28 or 29."
- .if (\\n(MN<1):(\\n(MN>12) .ER ".ST: MN (\\n(MN) undefined, less than 1 or more than 12."
- .if \\n(DT<1 .ER ".ST: starting date DT is less than 1 or not defined."
- '\" Put DT (starting date: 1, 2, ..., 31) in Dt (date register);
- '\" set Dt to one day before start of trip because first .SD will increment it:
- .nr Dt \\n(DT-1 1
- .rm DT
- .sp 1i
- .ps +4
- .ce 3
- ITINERARY \(em
- .sp 2
- \\$1
- .sp
- \\$2
- .ps
- '\" Don't print info below if user put -rQn on commandline:
- .if \\nQ=0 \{\
- .sp 2
- .ce 2
- The traveling costs in this itinerary are based on the assumption that
- each \\n(DU \*(UL travelled will cost one \\*(CS for gas, oil, etc.
- .sp \}
- ..
- .de ET \" end of title page macro
- .ie !\\n(sT=1 .ER ".ET: You must use the ST macro first."
- .el .nr sT 0
- .ie !\\n(eT=0 .ER ".ET: Only one .ET per file."
- .el .nr eT 1
- '\" set eD register so that first .SD doesn't say "missing .ED":
- .nr eD 1
- .nr sD 0
- '\" Set page number to one so first page of itinerary will have that number:
- .pn 1
- .bp
- ..
- .de ER
- .fl
- ***********************
- .br
- ERROR at input line \\n(.c: \\$1
- .br
- ***********************
- .ex
- ..
- .de NP \" new-page macro (from Kernighan tutorial, pg. 8)
- 'bp
- .ps +2
- 'sp 0.5i
- .if t .sp 0.3i \" more space if using troff
- 'tl ITINERARYPage %\\*(TI
- 'sp 0.3i
- .ps
- ..
- .wh -1i NP \" when get within 1 inch of page bottom, do NP (no . needed)
- '\" .HL draws em-dashes margin-to-margin.
- .de HL
- .br
- \l'\\n(.lu-\\n(.iu\&\(em'
- .br
- ..
- '\" Start-of-day macro
- .de SD
- .if !\\n(eT=1 .ER ".SD: You must use .ET first."
- .ie !\\n(eD=1 .ER ".SD: Missing .ED"
- .el .nr eD 0
- .ie !\\n(sD=0 .ER ".SD: Two .SD's with no .ED between"
- .el .nr sD 1
- .nr MT 0 \" set today's mileage (kilometrage?) to zero
- .nr CT 0 \" set today's cost to zero
- '\" handle month changes
- .if \\n(MN=1 .if \\n(Dt>30\{
- .nr MN 2
- .nr Dt 0\}
- .if \\n(MN=2 .if \\n(Dt>(\\n(FD-1)\{\
- .nr MN 3
- .nr Dt 0\}
- .if \\n(MN=3 .if \\n(Dt>30\{
- .nr MN 4
- .nr Dt 0\}
- .if \\n(MN=4 .if \\n(Dt>29\{
- .nr MN 5
- .nr Dt 0\}
- .if \\n(MN=5 .if \\n(Dt>30\{
- .nr MN 6
- .nr Dt 0\}
- .if \\n(MN=6 .if \\n(Dt>29\{
- .nr MN 7
- .nr Dt 0\}
- .if \\n(MN=7 .if \\n(Dt>30\{
- .nr MN 8
- .nr Dt 0\}
- .if \\n(MN=9 .if \\n(Dt>29\{
- .nr MN 10
- .nr Dt 0\}
- .if \\n(MN=10 .if \\n(Dt>30\{
- .nr MN 11
- .nr Dt 0\}
- .if \\n(MN=11 .if \\n(Dt>29\{
- .nr MN 12
- .nr Dt 0\}
- .if \\n(MN=12 .if \\n(Dt>30\{
- .nr MN 1
- .nr Dt 0\}
- '\" change day
- .ie '\\*(Dy'Sunday' .ds Dy Monday
- .el .ie '\\*(Dy'Monday' .ds Dy Tuesday
- .el .ie '\\*(Dy'Tuesday' .ds Dy Wednesday
- .el .ie '\\*(Dy'Wednesday' .ds Dy Thursday
- .el .ie '\\*(Dy'Thursday' .ds Dy Friday
- .el .ie '\\*(Dy'Friday' .ds Dy Saturday
- .el .ds Dy Sunday
- '\" start keep (from Kernighan tutorial, pg. 12)
- .br \" start fresh line
- .di Xx \" collect text in diversion (macro) Xx
- DAY #\\n+(DA OF TRIP: \\*(Dy, \\n(MN/\\n+(Dt
- .sp
- ..
- '\" Entry macro. $1 = hour, $2 = AM/PM/etc., "$3" = description, $4 = miles/km
- .de EN
- .if !\\n(sD=1 .ER ".EN: Missing .SD"
- .ie \\$4>0 .tl \\$1 \\$2\0\0\\$3\\$4 \*(US
- .el \\$1 \\$2\0\0\\$3
- .nr MT +\\$4
- ..
- '\" Food macro. $1 = Description; $2 = cost in CS units, decimals truncated:
- .de FO
- .if !\\n(sD=1 .ER ".FO: Missing .SD"
- .nr CT +\\$2
- .br
- FOOD: \\$1 \\*(CS\\$2.
- ..
- '\" Lodging macro. $1 = Description; $2 = cost in CS units, decimals truncated:
- .de LO
- .if !\\n(sD=1 .ER ".LO: Missing .SD"
- .nr CT +\\$2
- .br
- LODGING: \\$1 \\*(CS\\$2.
- ..
- '\" Other-expense macro. $1 = Description; $2 = cost in CS units:
- .de OE
- .if !\\n(sD=1 .ER ".OE: Missing .SD"
- .nr CT +\\$2
- .br
- OTHER: \\$1 \\*(CS\\$2.
- ..
- '\" End of day macro. $1 = number of hours today
- .de ED
- .ie !\\n(sD=1 .ER ".ED: Missing .SD"
- .el .nr sD 0
- .ie !\\n(eD=0 .ER ".ED: Two .ED's with no .SD between."
- .el .nr eD 1
- .if !\\n(.$=1 .ER ".ED: missing or too many arguments."
- .nr TT (\\n(MT/\\n(DU) \" total travel cost = miles divided by miles/dollar
- .nr OT \\n(CT \" other total (TT not added in yet)
- .nr CT (\\n(TT+\\n(OT) \" overwrite CT to hold total cost today: TT + OT
- .nr CO +\\n(CT \" add today's cost to total trip cost
- .nr MI +\\n(MT \" add today's miles (MT) to total trip miles (MI)
- .sp
- .fi
- '\" If -rQ1 was used on commandline, don't print lines:
- .if \\nQ=0 \{\
- TODAY:\0travel \\n(MT \\*(UL in \\$1
- .ie '\\$1'1' hour
- .el hours
- for \\*(CS\\n(TT; other costs \\*(CS\\n(OT; total \\*(CS\\n(CT
- .nf
- TO DATE:\0\\n(MI \\*(UL, \\*(CS\\n(CO \}
- .HL
- '\" end keep
- .br \" get last partial line
- .di \" end diversion
- .if \\n(dn>=\\n(.t .bp \" do .bp if text doesn't fit on current page
- .Xx \" bring back text stored in Xx macro
- ..
- SHAR_EOF
- echo shar: 8 control characters may be missing from "'tmac.ti'"
- if test 6340 -ne "`wc -c < 'tmac.ti'`"
- then
- echo shar: error transmitting "'tmac.ti'" '(should have been 6340 characters)'
- fi
- fi
- exit 0
- # End of shell archive
-